import axios from "@/plugins/axios";

const fileHttp = axios.create({
  headers: {
    "X-Requested-With": "XMLHttpRequest",
    "Content-Type": "multipart/form-data",
  },
});

const PREFIX = process.env.VUE_APP_API_URL_YUDA;
const PREFIXTWO = process.env.VUE_APP_API_URL_XUEKUI_TWO;

let knowledgeGeneration = {
  uploadSourceFile: (form) =>
    fileHttp.post(PREFIX + "/generate/uploadSourceFile", form),
  // 获取源数据文件列表
  getSourceDataList: (params) =>
    axios.post(PREFIX + "/generate/sourceDataList", params),
  // 获取本体模型列表
  getOntologyModel: () => axios.get(PREFIX + "/generate/chooseOntologyModel"),
  // 获取抽取模型列表
  getExtractModel: () => axios.get(PREFIX + "/generate/chooseExtractModel"),
  // 标注源数据接口
  annotationSourceData: (params) =>
    axios.post(PREFIX + "/generate/annotationSourceData", params),
  // 标注数据列表接口
  annotationDataList: (params) =>
    axios.post(PREFIX + "/generate/annotationDataList", params),
  // 标注数据查看接口
  annotationDataDetail: (params) =>
    axios.post(PREFIX + "/generate/annotationDataDetail", params),

  // 导入图谱接口
  importAnnationData: (params) =>
    axios.post(PREFIX + "/generate/importAnnationData", params),
  // 保存或编辑标注接口
  saveOrUpdateAnnotation: (params) =>
    axios.post(PREFIX + "/generate/saveOrUpdateAnnotation", params),

  // 保存或编辑标注接口
  preAnnotation: (params) =>
    axios.post(PREFIX + "/generate/preAnnotation", params),

  // 抽取源数据接口
  extractSourceData: (params) =>
    axios.post(PREFIX + "/generate/extractSourceData", params),
  // 删除源数据接口
  deleteSourceData: (params) =>
    axios.get(PREFIX + "/generate/deleteSourceData", { params }),
  // 标注数据查看实体接口
  annotationEntityList: (params) =>
    axios.post(PREFIX + "/generate/annotationEntityList", params),
  // 标注数据查看属性接口
  annotationPropertyList: (params) =>
    axios.post(PREFIX + "/generate/annotationPropertyList", params),
  // 标注数据查看关系接口
  annotationRelationList: (params) =>
    axios.post(PREFIX + "/generate/annotationRelationList", params),
  // 删除标注记录
  deleteAnnotationRecord: (params) =>
    axios.post(PREFIX + "/generate/deleteAnnotationRecord", params),
  // 抽取数据列表查询接口
  extractDataList: (params) =>
    axios.post(PREFIX + "/generate/extractDataList", params),
  // 抽取数据实体接口
  extractEntityList: (params) =>
    axios.post(PREFIX + "/generate/extractEntityList", params),
  // 抽取数据属性接口
  extractPropertyList: (params) =>
    axios.post(PREFIX + "/generate/extractPropertyList", params),
  // 抽取数据关系接口
  extractRelationList: (params) =>
    axios.post(PREFIX + "/generate/extractRelationList", params),
  // 抽取数据导入图谱接口
  importExtractData: (params) =>
    axios.post(PREFIX + "/knowledgeFusion/importGraph", params),
  // 抽取数据导入图谱接口
  saveOrUpdateExtraction: (params) =>
    axios.post(PREFIX + "/generate/saveOrUpdateExtraction", params),
  // 抽取数据确认图谱接口
  extractConfirme: (params) =>
    axios.post(PREFIX + "/generate/extractConfirme", params),
  // 抽取数据校核接口
  extractProofread: (id) =>
    // axios.post(PREFIX + "/generate/extractProofread", params),
    axios.get(PREFIX + "/extraction/getCheckData?extractionDataRecordId=" + id),
  // 删除抽取数据接口
  deleteExtractionRecord: (params) =>
    axios.post(PREFIX + "/generate/deleteExtractionRecord", params),

  // 抽取任务列表
  getExtractTaskList: (params) => axios.post(PREFIX + "/generate/extractDataList", params),
  // 删除抽取任务
  delExtractTask: (params) => axios.put(PREFIX + "/generate/delExtraction", params),
  // 开始/重新开始
  startExtractTask: (params) => axios.get(PREFIX + "/generate/startExtraction", { params }),
  // 暂停
  pauseExtractTask: (params) => axios.get(PREFIX + "/generate/pauseExtraction", { params }),
  // 修改抽取任务
  updateExtractTask: (params) => axios.put(PREFIX + "/generate/updateExtraction", params),

  // 子任务列表
  getExtractTaskSubList: (params) => axios.get(PREFIX + "/extraction/extractionItemList", { params }),


  // 抽取任务 结构化抽取 查询抽取映射配置
  getStructExtractConfig: (params) => axios.get(PREFIX + "/extraction/getStructuredExtractionMappingRecord", { params }),
  // 抽取任务 结构化抽取 开始执行抽取任务
  startStructExtract: (params) => axios.post(PREFIX + "/extraction/startStructuredExtraction", params),
  // 抽取任务 结构化抽取 解析文件信息
  getStructExtractFile: (params) => axios.get(PREFIX + "/extraction/parseExcel", { params }),

  // 抽取规则
  // 抽取规则列表接口
  getExtractRuleList: (params) => axios.get(PREFIX + "/generate/searchRuleList", { params }),
  // 查询启用的全部抽取规则
  getAllEnableExtractRule: () => axios.get(PREFIX + "/generate/chooseExtractRule"),
  // 新增抽取规则
  addExtractRule: (params) => axios.post(PREFIX + "/generate/addExtrationRule", params),
  // 编辑抽取规则
  editExtractRule: (params) => axios.put(PREFIX + "/generate/updateRule", params),
  // 抽取规则详情
  extractRuleDetail: (params) => axios.get(PREFIX + "/generate/detailRule", { params }),
  // 启用抽取规则
  enableExtractRule: (params) => axios.put(PREFIX + "/generate/enableRule", params),
  // 禁用抽取规则
  disableExtractRule: (params) => axios.put(PREFIX + "/generate/disableRule", params),
  // 删除规则
  delExtractRule: (params) => axios.delete(PREFIX + "/generate/deleteRuleById", { params }),


  // 选择图谱名称下拉框接口
  chooseGraph: (params) => axios.post(PREFIX + "/generate/chooseGraph", params),

  // 实体链接列表接口
  getEntityLinkList: (params) =>
    axios.post(PREFIX + "/generate/entityLinkList", params),
  // 实体链接信息接口
  getEntityLinkProofreadInfo: (params) =>
    axios.post(PREFIX + "/generate/entityLinkProofread", params),
  // 保存实体链接接口
  saveEntityLink: (params) =>
    axios.post(PREFIX + "/generate/saveEntityLink", params),
  // 取消实体链接接口
  cancelEntityLink: (params) =>
    axios.post(PREFIX + "/generate/cancelEntityLink", params),

  // 知识获取列表
  getKAList: (params) => axios.post(PREFIX + "/generate/kaList", params),
  // 知识获取列表
  getKADetail: (params) => axios.post(PREFIX + "/generate/kaDetail", params),
  // 选择知识获取抽取模型接口
  getKAModel: (params) =>
    axios.post(PREFIX + "/generate/chooseKaModel", params),
  // 输入抽取接口
  inputExtract: (params) =>
    axios.post(PREFIX + "/generate/inputExtract", params),
  // 输入抽取接口
  deleteKA: (params) => axios.post(PREFIX + "/generate/deleteKa", params),

  // 模型管理获取所有数据的接口
  getAllModel: (params) => axios.post(PREFIXTWO + "/model/getAllModel", params),
  // 删除模型的接口
  deleteModel: (params) => axios.post(PREFIXTWO + "/model/deleteModel", params),
  // 发布模型的接口
  changeModel: (params) => axios.post(PREFIXTWO + "/model/changeModel", params),
  // 训练模型的接口
  trainModel: (params) => axios.post(PREFIXTWO + "/model/trainModel", params),
  // 打开模型训练的弹窗
  openModelTraning: (params) =>
    axios.post(PREFIX + "/generate/modelTraning", params),
  // 打开编辑模型的弹窗
  updateModel: (params) => axios.post(PREFIX + "/generate/updateModel", params),
  // 保存模型的弹窗
  saveModel: (params) => axios.post(PREFIX + "/generate/saveModel", params),
  // 目标特性抽取
  imageList: (params) => axios.get(PREFIX + "/image/pageList", { params }),
  imageDetail: (params) => axios.get(PREFIX + `/image/detail/${params}`),
  imageDelete: (params) => axios.post(PREFIX + "/image/delete", { params }),
};
export { knowledgeGeneration };
export default knowledgeGeneration;
